import request from '@/utils/request'

// 获取员工简单列表
export const getEmployeeSimple = () => request({
  url: '/sys/user/simple'
})

// 获取员工列表
export const getEmployeeList = (params) => request({
  url: '/sys/user',
  params
})

// 保存个人信息
export const saveUserDetailById = (data) => request({
  url: `/sys/user/${data.id}`,
  method: 'put',
  data
})

// 新增员工
export const addEmployee = (data) => request({
  url: `/sys/user`,
  method: 'post',
  data
})

// 删除员工
export const delEmployee = (id) => request({
  url: `/sys/user/${id}`,
  method: 'delete'
})

// excel导入员工
export const importEmployee = (data) => request({
  url: `/sys/user/batch`,
  method: 'post',
  data
})

// 读取用户详情的基础信息
export const getPersonalDetail = (id) => request({
  url: `/employees/${id}/personalInfo`
})

// 更新用户详情的基础信息
export const updatePersonal = (data) => request({
  url: `/employees/${data.userId}/personalInfo`,
  method: 'put',
  data
})

// 获取用户的岗位信息
export const getJobDetail = (id) => request({
  url: `/employees/${id}/jobs`
})

// 保存岗位信息
export const updateJob = (data) => request({
  url: `/employees/${data.userId}/jobs`,
  method: 'put',
  data
})
